//
//  RBProcessOrderShopAddressVC.m
//  zhongzhenglu
//
//  Created by XL on 2022/8/16.
//

#import "RBProcessOrderShopAddressVC.h"
#import "RBGradientView.h"
#import "RBProcessOrderResponse.h" //model

@interface RBProcessOrderShopAddressVC ()


@property (nonatomic, strong) RBProcessOrderShopAddressResponse *response;

@end

@implementation RBProcessOrderShopAddressVC

#pragma mark - Lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self setup];
    [self getData];
}

#pragma mark - Private

- (void)setup
{
    self.title = @"商家地址";
    self.view.backgroundColor = [RBThemeConfig bgGrayColor];
}

- (void)fillData
{
    UIView *view = UIView.new;
    [view rbSetCornerRadius:Zoom(5)];
    [self.view view_addView:view withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:Zoom(10) bottom:CGFLOAT_MIN left:Zoom(15) right:Zoom(15) centerX:0];
    
    RBGradientView *bgView = [RBGradientView gradientViewWithColors:@[[UIColor colorWithHexString:@"#D9E6FF"],UIColor.whiteColor] locations:@[@0, @0.3] vertical:YES];
    [view addSubview:bgView];
    [bgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.mas_equalTo(0);
    }];
    
    UIView *topLineView = UIView.new;
    topLineView.backgroundColor = [UIColor colorWithHexString:@"3974EC"];
    [view view_addView:topLineView withHeight:Zoom(7) width:CGFLOAT_MIN top:0 bottom:0 left:0 right:0 centerX:0];
    
    [view view_addView:({
        UIView *view = UIView.new;
        
        [view h_view_addView:[RanTool imgViewWithMode:2 radius:Zoom(6) imgName:self.response.data.logo] withHeight:Zoom(36) width:Zoom(36) top:0 bottom:0 left:0 right:CGFLOAT_MIN centerY:0];
        
        [view h_view_addView:[RanTool labelWithFontSize:Zoom(15) weight:2 color:[RBThemeConfig textBlackColor] align:0 text:self.response.data.store_name] withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:CGFLOAT_MIN bottom:CGFLOAT_MIN left:Zoom(13) right:CGFLOAT_MIN centerY:YES];

//        [view h_view_addView:({
//            UILabel *view = [RanTool labelWithFontSize:Zoom(12) weight:1 color:UIColor.whiteColor align:1 text:@"复制" bgColor:[RBThemeConfig buttonBlueColor] radius:Zoom(12)];
//            [view addPriority:1];
//            view;
//        }) withHeight:Zoom(24) width:Zoom(57) top:CGFLOAT_MIN bottom:CGFLOAT_MIN left:Zoom(13) right:0 centerY:YES];
        view;
    }) withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:Zoom(15) bottom:0 left:Zoom(12) right:Zoom(12) centerX:0];
    
    [view view_addView:({
        UIView *view = UIView.new;
        [view h_view_addView:[RanTool labelWithFontSize:Zoom(13) weight:1 color:[RBThemeConfig textLightBlackColor] align:0 text:@"收件人"] withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:0 bottom:0 left:0 right:0 centerY:0];
        [view h_view_addView:({
            UILabel *view = [RanTool labelWithFontSize:Zoom(13) weight:2 color:[RBThemeConfig textBlackColor] align:0 text:self.response.data.name];
            [view addPriority:1];
            view;
        }) withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:0 bottom:0 left:0 right:0 centerY:0];
        view;
    }) withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:Zoom(30) bottom:Zoom(21) left:Zoom(13) right:Zoom(12) centerX:0];
    
    [view view_addView:({
        UIView *view = UIView.new;
        [view h_view_addView:[RanTool labelWithFontSize:Zoom(13) weight:1 color:[RBThemeConfig textLightBlackColor] align:0 text:@"联系方式"] withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:0 bottom:0 left:0 right:0 centerY:0];
        [view h_view_addView:({
            UILabel *view = [RanTool labelWithFontSize:Zoom(13) weight:2 color:[RBThemeConfig textBlackColor] align:0 text:self.response.data.mobile];
            [view addPriority:1];
            view;
        }) withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:0 bottom:0 left:0 right:0 centerY:0];
        view;
    }) withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:Zoom(15) bottom:Zoom(21) left:Zoom(13) right:Zoom(12) centerX:0];
    
    [view view_addView:({
        UIView *view = UIView.new;
        [view h_view_addView:[RanTool labelWithFontSize:Zoom(13) weight:1 color:[RBThemeConfig textLightBlackColor] align:0 text:@"地址"] withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:0 bottom:0 left:0 right:0 centerY:0];
        [view h_view_addView:({
            UILabel *view = [RanTool labelWithFontSize:Zoom(13) weight:2 color:[RBThemeConfig textBlackColor] align:0 text:({
                NSString *address = [NSString stringWithFormat:@"%@%@%@%@", self.response.data.province, self.response.data.city, self.response.data.qu, self.response.data.address];
                address;
            })];
            view.numberOfLines = 0;
            [view addPriority:1];
            view;
        }) withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:0 bottom:0 left:0 right:0 centerY:0];
        view;
    }) withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:Zoom(15) bottom:Zoom(21) left:Zoom(13) right:Zoom(12) centerX:0];
    
}

#pragma mark - Network
- (void)getData {
    LCWeakSelf;
    [self viewLoadDataWithParam:^(NSMutableDictionary *dicM) {
        dicM[@"store_id"] = self.store_id;
    } path:_Shop_address post:YES log:YES responseClass:RBProcessOrderShopAddressResponse.class desView:self.view showHud:YES showPlaceHolder:NO sucBlock:^(id data) {
        weakSelf.response = data;
        [weakSelf fillData];
    } failBlock:^(RBProcessOrderShopAddressResponse *data) {
        [weakSelf.view showTip:data.message completion:nil];
    } reloadBlock:nil];
}

#pragma mark - Event

#pragma mark - Setter

#pragma mark - Getter

@end
